<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>


<h1>Flights:</h1>


<c:if test="${not empty error}">
	<div class="danger">
		<p class="alert alert-danger">${error}</p>
	</div>
</c:if>
<table id="flightsTable" border="1"
	class="table table-striped table-bordered">
	<tr>
		<th>Start Place</th>
		<th>End Place</th>
		<th>Departure Time</th>
		<th>Occupied Seats</th>
		<th>Price</th>
		<th>Baggage</th> 
		<th>Vip</th>
		<th>Purchased</th>
		<th>Action</th>

	</tr>

	<c:forEach items="${flights}" var="flight">

		<tr id="c${flight.id}">
			<td>${flight.flight.startPlace}</td>
			<td>${flight.flight.endPlace}</td>
			<td>${flight.flight.departureTime}</td>
			<td>${flight.flight.numberOfSeats}</td>
			<td>${flight.price}</td>
			<td>${flight.baggage}</td>
			<td>${flight.vip}</td>
			<td>${flight.purchased}</td>
	 	<td><c:if test="${flight.purchased == false}">
					<a
						href="<c:url value="/profile/flights/${flight.id}/purchase" />">
						Purchase </a> &nbsp;/&nbsp;
						<a
						href="<c:url value="/profile/flights/${flight.flight.flightId}/cancel" />">
						Cancel </a> &nbsp;
						
						
						</c:if></td>
	</c:forEach>


</table>
<div id="result"></div>
